package cate.game.role.res.holy_pet.core;

import cate.game.role.Role;
import cate.game.role.RoleSnapshot;
import easy.java.dev.note.NoteField;

/**
 * 灵宠日志
 *
 * @author ShenSL
 * @since 2023/9/6 17:11
 */
public class HolyPetAdventureLog {
    @NoteField("日志类型1触发2协助完成")
    public int type;
    @NoteField("派遣地点")
    public int placeId;
    @NoteField("派遣灵宠ID")
    public int petId;
    @NoteField("机遇事件ID")
    public int adventureId;
    @NoteField("记录时间")
    public long logTime;
    @NoteField("协助者快照")
    public RoleSnapshot helper;

    /**
     * 生成机缘触发事件
     *
     * @param petId       灵宠ID
     * @param adventureId 机遇事件ID
     */
    public static HolyPetAdventureLog TRIGGER(int placeId, int petId, int adventureId) {
        HolyPetAdventureLog log = new HolyPetAdventureLog();
        log.type = 1;
        log.placeId = placeId;
        log.petId = petId;
        log.adventureId = adventureId;
        log.logTime = System.currentTimeMillis();
        return log;
    }

    /**
     * 生成机缘协助事件
     *
     * @param petId       灵宠ID
     * @param adventureId 机遇事件ID
     * @param helperRole  协助者
     */
    public static HolyPetAdventureLog HELP(int placeId, int petId, int adventureId, Role helperRole) {
        HolyPetAdventureLog log = new HolyPetAdventureLog();
        log.type = 2;
        log.placeId = placeId;
        log.petId = petId;
        log.adventureId = adventureId;
        log.logTime = System.currentTimeMillis();
        log.helper = new RoleSnapshot(helperRole);
        return log;
    }
}
